$(function(){
	// document ready call functions
	siteMenu();  
	fixedPosition();

	if ($("#content").attr('id') != undefined) {
        $("#content").tinyscrollbar();
    }	
});
// resize call functions
$(window).wresize(function(){
	fixedPosition();
	fixedPosition(); // temp fix scrollbar space
	
	if ($("#content").attr('id') != undefined) {
        $("#content").tinyscrollbar();
    }
});
//---------------------------jquery ui alert box---------------------------
function ui_alert(msg, title){
	msg = msg == undefined ?'':msg;
	title = title == undefined ?'':title;
	$( '#dialog:ui-dialog' ).dialog( 'destroy' );
	$('<div><span class="ui-icon ui-icon-info" style="float:left; margin:0 7px 20px 0;"></span>'+msg+'</div>').dialog({
		title: title,
		width: 500,
		resizable: false,
		modal: true,
		buttons: { 
			'OK': function() { 
				$(this).dialog('close'); 
			}			
		}
	});
}

//---------------------------site menu---------------------------
function siteMenu(){
    $("#site_menu").lavaLamp({
        fx: "backout",
        speed: 700,
        click: function(event, menuItem){
            return false;
        }
    });
}
//---------------------------fixedPosition---------------------------
function fixedPosition(){
	var browserWidth = $(window).width();
	var browserHeight = $(window).height();	
	var minBrowserWidth = browserWidth > 950 ? browserWidth : 950;
	var minBrowserHeight = browserHeight > 600 ? browserHeight : 600;
	var extraReduceHeight = 0;
	if ($('#content_menu').attr('id') != undefined){
		extraReduceHeight = 40;
	}
	$('#container').width(minBrowserWidth).height(minBrowserHeight);	
    $('#content .viewport').height(minBrowserHeight - 200 - extraReduceHeight);
    $('#content .track').height(minBrowserHeight - 200 - extraReduceHeight);
    $('#TopBg').width(minBrowserWidth);
    $('#footer').width(minBrowserWidth);
    $('#marquee').width(minBrowserWidth - 410);
	$('#marquee table tr td ul').width((minBrowserWidth - 410)/3);
};


